{include file="/shopro/common/script" /}

<div id="index" class="reward-index panel panel-default panel-intro" v-cloak>
    <el-container class="panel-block">
        <el-header class="sa-header">
            <div class="sa-title sa-flex sa-row-between">
                <div class="sa-title-left">
                    <div class="left-name">月度达标奖明细</div>
                    <sa-filter-condition v-model="state.filter" @filter-delete="onChangeFilter">
                    </sa-filter-condition>
                </div>
                <div class="sa-title-right">
                    <el-button class="sa-button-refresh" icon="RefreshRight" @click="getData"></el-button>
                    <el-button class="sa-button-refresh" icon="Search" @click="onOpenFilter"></el-button>
                    {if $auth->check('shopro/commission/monthly_compliance/export')}
                    <el-button :loading="exportLoading" :disabled="exportLoading" @click="onExport('export')">导出
                    </el-button>
                    {/if}
                </div>
            </div>
        </el-header>
        <el-main class="sa-main">
            <el-table height="100%" class="sa-table" :data="state.data" stripe>
                <el-table-column prop="id" label="ID" min-width="90"></el-table-column>
                <el-table-column label="用户" min-width="160">
                    <template #default="scope">
                        <sa-user-profile :user="scope.row.user" :id="scope.row.user_id"></sa-user-profile>
                    </template>
                </el-table-column>
                <el-table-column label="身份证号" min-width="160">
                    <template #default="scope">
                        {{ scope.row.user.ID_number }}
                    </template>
                </el-table-column>
                <!--<el-table-column prop="day_time" label="应发月份" min-width="80"></el-table-column>-->
                <el-table-column prop="year" label="年" min-width="80"></el-table-column>
                <el-table-column prop="month" label="月" min-width="80"></el-table-column>
                <el-table-column label="业绩金额" min-width="160">
                    <template #default="scope"> {{ scope.row.performance }}元 </template>
                </el-table-column>
                <el-table-column label="小市场业绩" min-width="160">
                    <template #default="scope"> {{ scope.row.performance_min }}元 </template>
                </el-table-column>
                <!--<el-table-column label="入账状态" min-width="80">
                    <template #default="scope">
                        <span :class="`sa-color&#45;&#45;${state.statusStyle[scope.row.status]}`">
                            {{ scope.row.status_text }}
                        </span>
                    </template>
                </el-table-column>-->
                <el-table-column prop="rate" label="奖金比例" min-width="80"></el-table-column>
                <el-table-column label="是否发放" min-width="80">
                    <template #default="scope">
                        <span v-if="scope.row.is_grant==0">
                            否
                        </span>
                        <span v-if="scope.row.is_grant==1">
                            是
                        </span>
                    </template>
                </el-table-column>
                <el-table-column prop="grant_time" label="发放时间" min-width="80"></el-table-column>
                <el-table-column prop="createtime" label="创建时间" min-width="80"></el-table-column>
                <el-table-column prop="money" label="应发奖励" min-width="80"></el-table-column>
                <el-table-column label="发放管理员" min-width="80">
                    <template #default="scope">
                        <sa-user-profile :user="scope.row.admin" :id="scope.row.admin_id"></sa-user-profile>
                    </template>
                </el-table-column>
                <!--<el-table-column prop="voucher" label="凭证" min-width="80"></el-table-column>-->
                <el-table-column prop="remark" label="备注" min-width="80"></el-table-column>
                <el-table-column label="操作" min-width="160" fixed="right">
                    <template #default="scope">
                        <div class="sa-flex">
                            {if $auth->check('shopro/commission/monthly_compliance/edit')}
                            <el-button v-if="scope.row.is_grant==0" type="success" link @click="onChangeGrant(scope.row.id)">
                                发放
                            </el-button>
                            {/if}
                            {if $auth->check('shopro/commission/monthly_compliance/detail')}
                            <el-button type="primary" link @click="onDetail(scope.row.id)">查看</el-button>
                            {/if}
                        </div>
                    </template>
                </el-table-column>
            </el-table>
        </el-main>
        <el-footer class="sa-footer sa-flex sa-row-right">
            <sa-pagination v-model="pagination" @pagination-change="getData"></sa-pagination>
        </el-footer>
    </el-container>
    <sa-filter v-model="state.filter" @filter-change="onChangeFilter"></sa-filter>
</div>